package com.aaa.dao;


import com.aaa.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select u.uid,u.uname,u.username,u.password,u.sex,u.address,u.createtime,u.phone,u.email,r.rolename,u.picture,u.state from user u left join role r on u.rid=r.rid")
    List<User> select();
//    @Update("UPDATE user  SET uname=#{uname}, username=#{username}, password={#password}, sex={#sex}, address=#{address}, createtime=#{createtime}, phone=#{phone}, email=#{email}, rid={rid},  state=#{state}  WHERE uid=#{uid}")
//    int update2(User user);
    @Select("select u.uid,u.uname,u.username,u.password,u.sex,u.address,u.createtime,u.phone,u.email,r.rolename,u.picture,u.state from user u left join role r on u.rid=r.rid where username=#{username}")
    List<User> select2(String username);
}
